package com.ruoyi.wxapp.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.wxapp.mapper.WxappUsersMapper;
import com.ruoyi.wxapp.domain.WxappUsers;
import com.ruoyi.wxapp.service.IWxappUsersService;

/**
 * 微信用户Service业务层处理
 * 
 * @author jktam
 * @date 2025-11-04
 */
@Service
public class WxappUsersServiceImpl implements IWxappUsersService 
{
    @Autowired
    private WxappUsersMapper wxappUsersMapper;

    /**
     * 查询微信用户
     * 
     * @param id 微信用户主键
     * @return 微信用户
     */
    @Override
    public WxappUsers selectWxappUsersById(Long id)
    {
        return wxappUsersMapper.selectWxappUsersById(id);
    }

    
    @Override
    public WxappUsers selectUserByOpenId(String openid) {
        return wxappUsersMapper.selectWxappUsersByOpenId(openid);
    }

    /**
     * 查询微信用户列表
     * 
     * @param wxappUsers 微信用户
     * @return 微信用户
     */
    @Override
    public List<WxappUsers> selectWxappUsersList(WxappUsers wxappUsers)
    {
        return wxappUsersMapper.selectWxappUsersList(wxappUsers);
    }

    /**
     * 新增微信用户
     * 
     * @param wxappUsers 微信用户
     * @return 结果
     */
    @Override
    public int insertWxappUsers(WxappUsers wxappUsers)
    {
        wxappUsers.setCreateTime(DateUtils.getNowDate());
        return wxappUsersMapper.insertWxappUsers(wxappUsers);
    }

    /**
     * 修改微信用户
     * 
     * @param wxappUsers 微信用户
     * @return 结果
     */
    @Override
    public int updateWxappUsers(WxappUsers wxappUsers)
    {
        wxappUsers.setUpdateTime(DateUtils.getNowDate());
        return wxappUsersMapper.updateWxappUsers(wxappUsers);
    }

    /**
     * 批量删除微信用户
     * 
     * @param ids 需要删除的微信用户主键
     * @return 结果
     */
    @Override
    public int deleteWxappUsersByIds(Long[] ids)
    {
        return wxappUsersMapper.deleteWxappUsersByIds(ids);
    }

    /**
     * 删除微信用户信息
     * 
     * @param id 微信用户主键
     * @return 结果
     */
    @Override
    public int deleteWxappUsersById(Long id)
    {
        return wxappUsersMapper.deleteWxappUsersById(id);
    }
}
